// 读取输入，知道读到EOF， 
// 报告读入的单词数、大写字母数、小写字母数、标点符号数、数字字符数

#include <stdio.h>
#include <ctype.h>
#include <stdbool.h>

int main(void)
{
	char ch;
	bool inword = false;
	int u_letters, l_letters, punct_chars, digits, words;
	u_letters = l_letters = punct_chars = digits = words = 0;

	while ((ch = getchar() != EOF))
	{
		if (isalpha(ch)) {
			if (!inword)
            {
                inword = true;
                words++;
            }
            if (isupper(ch))
                u_letters++;
            if (islower(ch))
                l_letters++;
		} else if (ispunct(ch)) {
            punct_chars++;

        } else if (isdigit(ch)) {
            digits++;
            inword = false;
        } else if (isspace(ch))
            inword = false;
	}
    printf("\nwords = %d, lowercase = %d, uppercase = %d, digits = %d, punctuation = %d\n", words, l_letters, u_letters, digits, punct_chars);

	return 0; 
}
